using System;
using System.Collections.Generic;
using System.Text;
using System.Data.Common;
using System.Data;
using XBLib.Dal.AdoDal;
using DataInfo;
using KenLib.Common;
namespace KenLib.Dal
{
    public class 資格情報Dao : BaseAdoDao
      {
          private string m_requestTime;
          private string m_displayTime;
          public int Insert(資格情報 obj)
          {
              int i = 0;
              try
              {
                  m_requestTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
                  DbParameter param20 = _daoHelper.CreateParameter("@廃止区分", obj.廃止区分, DbType.Int16);
                  DbParameter param1 = _daoHelper.CreateParameter("@資格コード", obj.資格コード, DbType.String);
                  DbParameter param2 = _daoHelper.CreateParameter("@資格", obj.資格, DbType.String);
                  DbParameter param3 = _daoHelper.CreateParameter("@発令開始日", obj.発令開始日, DbType.DateTime);
                  DbParameter param4 = _daoHelper.CreateParameter("@発令終了日", obj.発令終了日, DbType.DateTime);
                  DbParameter param5 = _daoHelper.CreateParameter("@実際開始日", obj.実際開始日, DbType.DateTime);
                  DbParameter param6 = _daoHelper.CreateParameter("@実際終了日", obj.実際終了日, DbType.DateTime);
                  DbParameter param7 = _daoHelper.CreateParameter("@変更理由", obj.変更理由, DbType.String);
                  DbParameter param8 = _daoHelper.CreateParameter("@社員ID", obj.社員ID, DbType.Int32);
                  DbCommand command = _daoHelper.CreateCommand(CommandNameManager.Insert_HumanDegreeByCompInfo, CommandType.StoredProcedure,param20, param1, param2, param3, param4, param5, param6, param7, param8);
                  i = _daoHelper.Execute(command);
                  m_displayTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
                  ExportFile.WriteLog("", "", "INSERT", "Insert_HumanDegreeByCompInfo", m_requestTime, m_displayTime);
              }
              catch (Exception ex)
              {
                  m_displayTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
                  ExportFile.WriteErr("", "", "SELECT", ex.Message, m_requestTime, m_displayTime);
              }
              return i;
          }

          public int Update(資格情報 obj)
          {
              int i = 0;
              try
              {
                  m_requestTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
                  DbParameter param20 = _daoHelper.CreateParameter("@廃止区分", obj.廃止区分, DbType.Int16);
                  DbParameter param0 = _daoHelper.CreateParameter("@ID", obj.ID, DbType.Int32);
                  DbParameter param1 = _daoHelper.CreateParameter("@資格コード", obj.資格コード, DbType.String);
                  DbParameter param2 = _daoHelper.CreateParameter("@資格", obj.資格, DbType.String);
                  DbParameter param3 = _daoHelper.CreateParameter("@発令開始日", obj.発令開始日, DbType.DateTime);
                  DbParameter param4 = _daoHelper.CreateParameter("@発令終了日", obj.発令終了日, DbType.DateTime);
                  DbParameter param5 = _daoHelper.CreateParameter("@実際開始日", obj.実際開始日, DbType.DateTime);
                  DbParameter param6 = _daoHelper.CreateParameter("@実際終了日", obj.実際終了日, DbType.DateTime);
                  DbParameter param7 = _daoHelper.CreateParameter("@変更理由", obj.変更理由, DbType.String);
                  DbParameter param8 = _daoHelper.CreateParameter("@社員ID", obj.社員ID, DbType.Int32);
                  DbCommand command = _daoHelper.CreateCommand(CommandNameManager.Update_HumanDegreeByCompInfo, CommandType.StoredProcedure,param20, param0, param1, param2, param3, param4, param5, param6, param7, param8);
                  i = _daoHelper.Execute(command);
                  m_displayTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
                  ExportFile.WriteLog("", "", "UPDATE", "Update_HumanDegreeByCompInfo", m_requestTime, m_displayTime);
              }
              catch (Exception ex)
              {
                  m_displayTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
                  ExportFile.WriteErr("", "", "SELECT", ex.Message, m_requestTime, m_displayTime);
              }
              return i;
          }

          public int Delete(int id)
          {
              int i = 0;
              try
              {
                  m_requestTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
                  DbParameter param0 = _daoHelper.CreateParameter("@ID", id, DbType.Int32);

                  DbCommand command = _daoHelper.CreateCommand(CommandNameManager.Delete_HumanDegreeByCompInfo, CommandType.StoredProcedure, param0);
                  i = _daoHelper.Execute(command);
                  m_displayTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
                  ExportFile.WriteLog("", "", "DELETE", "Delete_HumanDegreeByCompInfo", m_requestTime, m_displayTime);
              }
              catch (Exception ex)
              {
                  m_displayTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
                  ExportFile.WriteErr("", "", "SELECT", ex.Message, m_requestTime, m_displayTime);
              }
              return i;
          }

          public DataTable SelectData資格情報(int 社員ID)
          {
              DbParameter param社員ID = _daoHelper.CreateParameter("@社員ID", 社員ID, DbType.Int32);
              DbCommand command = _daoHelper.CreateCommand("sp_select_資格情報_Hunglt", CommandType.StoredProcedure, param社員ID);
              return _daoHelper.Query(command);
          }

          #region TUNG
          public DataTable Get資格情報(int 社員ID)
          {
              DbParameter param1 = _daoHelper.CreateParameter("@社員ID", 社員ID, DbType.Int32);
              DbCommand command = _daoHelper.CreateCommand("sp_Get資格情報_TUNG", CommandType.StoredProcedure,param1);
              return _daoHelper.Query(command);
          }
        
          #endregion


          #region Hunglt
		  public void UpdateInfo資格情報(資格情報 obj)
		  {
			  DbParameter dbParam廃止区分 = _daoHelper.CreateParameter("@廃止区分", obj.廃止区分, DbType.Int32);
			  DbParameter dbParam資格コード = _daoHelper.CreateParameter("@資格コード", Int32.Parse(obj.資格コード), DbType.Int32);
			  DbParameter dbParam資格 = _daoHelper.CreateParameter("@資格", obj.資格, DbType.String);
			  DbParameter dbParam発令開始日 = _daoHelper.CreateParameter("@発令開始日", obj.発令開始日, DbType.DateTime);
			  DbParameter dbParam発令終了日 = _daoHelper.CreateParameter("@発令終了日", obj.発令終了日, DbType.DateTime);
			  DbParameter dbParam実際開始日 = _daoHelper.CreateParameter("@実際開始日", obj.実際開始日, DbType.DateTime);
			  DbParameter dbParam実際終了日 = _daoHelper.CreateParameter("@実際終了日", obj.実際終了日, DbType.DateTime);
			  DbParameter dbParam変更理由 = _daoHelper.CreateParameter("@変更理由", obj.変更理由, DbType.String);
			  DbParameter param社員ID = _daoHelper.CreateParameter("@社員ID", obj.社員ID, DbType.Int32);

			  DbCommand dbcommand = _daoHelper.CreateCommand("sp_update_資格情報_FormJ_Hunglt", CommandType.StoredProcedure,
				 dbParam廃止区分, dbParam資格コード, dbParam資格, dbParam発令開始日, dbParam発令終了日, dbParam実際開始日, dbParam実際終了日, dbParam変更理由, param社員ID);
			  _daoHelper.Execute(dbcommand);
		  }
		  public void UpdateInfo資格情報_ByID(資格情報 obj, int ID)
		  {
			  DbParameter dbParam資格コード = _daoHelper.CreateParameter("@資格コード", Int32.Parse(obj.資格コード), DbType.Int32);
			  DbParameter dbParam資格 = _daoHelper.CreateParameter("@資格", obj.資格, DbType.String);
			  DbParameter dbParam発令開始日 = _daoHelper.CreateParameter("@発令開始日", obj.発令開始日, DbType.DateTime);
			  DbParameter dbParam実際開始日 = _daoHelper.CreateParameter("@実際開始日", obj.実際開始日, DbType.DateTime);
			  DbParameter dbparam社員ID = _daoHelper.CreateParameter("@社員ID", obj.社員ID, DbType.Int32);
			  DbParameter dbParamID = _daoHelper.CreateParameter("@ID", ID, DbType.Int32);

			  DbCommand dbcommand = _daoHelper.CreateCommand("sp_update_資格情報_FormO_Hunglt", CommandType.StoredProcedure,
				 dbParam資格コード, dbParam資格, dbParam発令開始日, dbParam実際開始日, dbparam社員ID, dbParamID);
			  _daoHelper.Execute(dbcommand);
		  }
		  public DataTable SelectInfo資格情報_ByID(int ID, int 社員ID)
		  {
			  DbParameter paramID = _daoHelper.CreateParameter("@ID", ID, DbType.Int32);
			  DbParameter param社員ID = _daoHelper.CreateParameter("@社員ID", 社員ID, DbType.Int32);
			  DbCommand command = _daoHelper.CreateCommand("sp_select_資格情報_FormO_Hunglt", CommandType.StoredProcedure, paramID, param社員ID);
			  return _daoHelper.Query(command);
		  }
          #endregion


          #region Phuong
          public void Insert資格情報(資格情報 obj)
          {
              DbParameter param1 = _daoHelper.CreateParameter("@社員ID", obj.社員ID, DbType.Int32);
              DbParameter param2 = _daoHelper.CreateParameter("@廃止区分", obj.廃止区分, DbType.Int32);
              DbParameter param3 = _daoHelper.CreateParameter("@資格コード", obj.資格コード1p1, DbType.Int16);
              DbParameter param4 = _daoHelper.CreateParameter("@発令開始日", obj.発令開始日, DbType.DateTime);
              DbParameter param5 = _daoHelper.CreateParameter("@発令終了日", obj.発令終了日, DbType.DateTime);
              DbParameter param6 = _daoHelper.CreateParameter("@実際開始日", obj.実際開始日, DbType.DateTime);
              DbParameter param7 = _daoHelper.CreateParameter("@実際終了日", obj.実際終了日, DbType.DateTime);
              DbParameter param8 = _daoHelper.CreateParameter("@変更理由", (obj.変更理由 == "") ? null : obj.変更理由, DbType.String);


              DbCommand command = _daoHelper.CreateCommand(CommandNameManager.sp_frmJ_StaffDegreeByCompInput_Insert_Phuong, CommandType.StoredProcedure, param1, param2, param3, param4, param5, param6, param7, param8);
               _daoHelper.Execute(command);
          }

          public DataTable select_資格情報(int 社員ID)
          {
              DbParameter param1 = _daoHelper.CreateParameter("@社員ID", 社員ID, DbType.Int32);
              DbCommand command = _daoHelper.CreateCommand("select_資格情報_luclt", CommandType.StoredProcedure, param1);
              return _daoHelper.Query(command);
          }

         public void Update資格情報(資格情報 obj)
          {
              DbParameter param1 = _daoHelper.CreateParameter("@ID", obj.ID, DbType.Int32);
              DbParameter param2 = _daoHelper.CreateParameter("@資格コード", obj.資格コード1p1, DbType.Int32);
              DbParameter param3 = _daoHelper.CreateParameter("@発令開始日", obj.発令開始日, DbType.DateTime);
              DbParameter param4 = _daoHelper.CreateParameter("@発令終了日", obj.発令終了日, DbType.DateTime);
              DbParameter param5 = _daoHelper.CreateParameter("@実際開始日", obj.実際開始日, DbType.DateTime);
              DbParameter param6 = _daoHelper.CreateParameter("@実際終了日", obj.実際終了日, DbType.DateTime);
              DbParameter param7 = _daoHelper.CreateParameter("@変更理由", obj.変更理由, DbType.String);


              DbCommand command = _daoHelper.CreateCommand(CommandNameManager.sp_frmJ_StaffDegreeByCompInput_Update_Phuong, CommandType.StoredProcedure, param1, param2, param3, param4, param5, param6, param7);
               _daoHelper.Execute(command);
          }
         public DataTable Get資格情報ByID(int ID)
         {
             DbParameter param1 = _daoHelper.CreateParameter("@ID", ID, DbType.Int32);
             DbCommand command = _daoHelper.CreateCommand(CommandNameManager.sp_frmJ_StaffDegreeByCompInput_GetById_Phuong, CommandType.StoredProcedure, param1);
             return _daoHelper.Query(command);
         }
         public DataTable Get資格情報By社員ID(int 社員ID)
         {
             DbParameter param1 = _daoHelper.CreateParameter("@社員ID", 社員ID, DbType.Int32);
             DbCommand command = _daoHelper.CreateCommand(CommandNameManager.sp_frmJ_StaffDegreeByCompInput_GetBy社員ID_Phuong, CommandType.StoredProcedure, param1);
             return _daoHelper.Query(command);
         }
        
          #endregion
      
      }
}
